<?php
include("../data/conf/config.php");
header("Cache-Control: no-cache, must-revalidate"); 
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
Header("Content-type: application/vnd.google-earth.kml+xml");
if(  !empty($_SERVER["QUERY_STRING"]) ) {
	if (!eregi("^http://",$_SERVER["QUERY_STRING"])) {
		print "ei."; exit;	
	}
	if(($site_url == $api_url) && (substr($_SERVER['QUERY_STRING'], 0, strlen($api_url)) == $api_url))
	{
		$query = substr($_SERVER['QUERY_STRING'],strlen($site_url)+1);
		$allowed = array('xml.php','xml-old.php','backend.php');
		if(strpos($query,'?') !== FALSE)
			$query = substr($query, 0, strpos($query,'?')); // Remove the ?12.4567-cachehack
		
		if(in_array($query, $allowed))
			include("../backend/$query");
		else
		{
			print "Srsly. No.";
			exit;
		}
	}
	else
		print file_get_contents($_SERVER["QUERY_STRING"]);
	exit;
}
?>